﻿#pragma once
#include "LuaObject.h"

//重载操作符
class LUAOBJ_API LuaInt:public LuaObject
{
public:
	LuaInt(const LuaObject& rfs)
		:LuaObject(rfs)
	{}

	bool isValid() const {return isNumber();}
	operator int() const {return toInt();}
};

class LUAOBJ_API LuaBool:public LuaObject
{
public:
	LuaBool(const LuaObject& rfs)
		:LuaObject(rfs)
	{}

	bool isValid() const  {return true;}
	operator bool() const {return toBool();}
};

class LUAOBJ_API LuaString :public LuaObject
{
public:
	LuaString(const LuaObject& rfs);
	~LuaString();

	bool isValid() const;

	const char* c_str() const;

	bool set(const char* str);
	bool set(const char* str, size_t len);
	bool set(const wchar_t* str, size_t len);

	operator const char*() const;

	size_t length() const;
};


class LUAOBJ_API LuaDouble:public LuaObject
{
public:
	LuaDouble(const LuaObject& rfs)
		:LuaObject(rfs)
	{}

	bool isValid() const {return isNumber();}
	operator double() const {return toNumber();}
};

class LUAOBJ_API LuaPtr:public LuaObject
{
public:
	LuaPtr(const LuaObject& rfs)
		:LuaObject(rfs)
	{}

	bool isValid() const {return isPtr();}
	operator const void*() const {return toPtr();}
};







